package com.tongzhou.client;

import net.sf.json.JSONObject;

import com.tongzhou.db.exception.DBException;
import com.tongzhou.tongzhou.quot.dao.IQuotRemarkDAO;
import com.tongzhou.tongzhou.quot.dao.impl.QuotRemarkDAO;
import com.tongzhou.tongzhou.quot.model.QuotRemark;

//报价接口
public class ClientQuot3 {
	IQuotRemarkDAO dao=new QuotRemarkDAO();
	public String getInfo(String json){
		JSONObject jsonObject = JSONObject.fromObject( json );
		Integer type=null;
		if(jsonObject.get("type")!=null){
			type=(Integer) jsonObject.get("type");
		}
//		Integer rid=(Integer) jsonObject.get("rid");
//		Integer qid=(Integer) jsonObject.get("qid");
//		Integer highRisk=(Integer) jsonObject.get("highRisk");
		
		StringBuffer str=new StringBuffer();
		if(type==null){
			return "{'success':0,'msg':'输入参数有误!'}";
		}else{
			QuotRemark quotRemark;
			try {
				quotRemark = dao.getQuotRemarkById(0);
				if(quotRemark!=null){
					str.append("{'success':1,'msg':{'content':'"+quotRemark.getRemark()+"'}}");
				}else{
					str.append("{'success':0,'msg':'没有对应的报价信息!'}");
				}
				return str.toString();
			} catch (DBException e) {
				e.printStackTrace();
			}
		}
			
//		String str="{'success':1,'msg':{'quotCode':'code-123','paperType':{'paperName':'基本',";
//		str+="'single':[{'pid':'1','paper':'纸质','price':'2.12','brand':'1','params':'明细各个参数'},";
//		str+="{'pid':'2','paper':'纸质2','price':'5','brand':'2','params':'明细各个参数2'}],";
//		str+="'double':[{'pid':'1','paper':'纸质','price':'2.12','brand':'1','params':'明细各个参数'},";
//		str+="{'pid':'2','paper':'纸质2','price':'5','brand':'2','params':'明细各个参数2'}]}}}";
//		String str2="{'success':1,'msg':{'quotCode':123,'content':'<html><head></head><body>报价备注</body>'}}";
//		str+="'double':[['id11','纸质11','单价11','明细各个参数11'],['id12','纸质12','单价12','明细各个参数13']]},";
//		str+="'singleDB':[['id21','纸质21','单价21','明细各个参数21'],['id22','纸质22','单价22','明细各个参数22']]}}}";
		return "{'success':0,'msg':'输入参数有误!'}";
	}
}
